]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Always show the workspace thumbnails if there is a monitor to the right
authorAlexander Larsson <alexl@redhat.com>
Fri, 18 Mar 2011 13:49:27 +0000 (14:49 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 21 Mar 2011 17:48:57 +0000 (18:48 +0100)
If there is a monitor to the right it is very easy to overshot the
expanding thumbnails and enter the next monitor. So, in that case
we just always show it.

https://bugzilla.gnome.org/show_bug.cgi?id=641877

js/ui/workspacesView.js

index d2a8851f7f77e9bcfaf94915346b78d22fed1c39..f7250c649fa7e5554539c6a97c53b26494ea9a58 100644 (file)
@@ -590,9 +590,15 @@ WorkspacesDisplay.prototype = {
 
         this._inDrag = false;
         this._cancelledDrag = false;
+
+        this._alwaysZoomOut = false;
         this._zoomOut = false;
         this._zoomFraction = 0;
 
+        this._updateAlwaysZoom();
+
+        global.screen.connect('monitors-changed', Lang.bind(this, this._updateAlwaysZoom));
+
         this._nWorkspacesNotifyId = 0;
         this._switchWorkspaceNotifyId = 0;
 
@@ -647,8 +653,8 @@ WorkspacesDisplay.prototype = {
                                                           Lang.bind(this, this._dragEnd));
 
         this._onRestacked();
-        this._zoomOut = false;
-        this._zoomFraction = 0;
+        this._zoomOut = this._alwaysZoomOut;
+        this._zoomFraction = this._alwaysZoomOut ? 1 : 0;
         this._updateZoom();
     },
 
@@ -707,6 +713,23 @@ WorkspacesDisplay.prototype = {
         return this._zoomFraction;
     },
 
+    _updateAlwaysZoom: function()  {
+        this._alwaysZoomOut = false;
+
+        let monitors = global.get_monitors();
+        let primary = global.get_primary_monitor();
+
+        /* Look for any monitor to the right of the primary, if there is
+         * one, we always keep zoom out, otherwise its hard to reach
+         * the thumbnail area without passing into the next monitor. */
+        for (let i = 0; i < monitors.length; i++) {
+            if (monitors[i].x >= primary.x + primary.width) {
+                this._alwaysZoomOut = true;
+                break;
+            }
+        }
+    },
+
     _getPreferredWidth: function (actor, forHeight, alloc) {
         // pass through the call in case the child needs it, but report 0x0
         this._controls.get_preferred_width(forHeight);
@@ -842,7 +865,7 @@ WorkspacesDisplay.prototype = {
         if (Main.overview.animationInProgress)
             return;
 
-        let shouldZoom = this._controls.hover || (this._inDrag && !this._cancelledDrag);
+        let shouldZoom = this._alwaysZoomOut || this._controls.hover || (this._inDrag && !this._cancelledDrag);
         if (shouldZoom != this._zoomOut) {
             this._zoomOut = shouldZoom;
             this._updateWorkspacesGeometry();